package idv.jieh.commons.sql;

import java.sql.*;
import idv.jieh.commons.comm.BasicClass;

public class TableFactory extends BasicClass {

  private TableAdapter table;
  public TableFactory(TableAdapter table){
    this.table = table;
  }

  public void query(
    DatabaseAdapter da,
    TableCache tc,
    ColumnAdapter column,
    String value
  )throws SQLException{
    SQLMaker sm = new SQLMaker();
    sm.append("SELECT * FROM ").append(table);
    if(column != null){
      sm.append(" WHERE");
      column.factory().addSQLWhere(sm, value);
    }
    sm.generateTableCache(da, tc);
  }
}
